package cn.edu.scau.cmi.ema.domain;


import java.io.Serializable;

import java.lang.StringBuilder;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.persistence.*;
import javax.xml.bind.annotation.*;
import cn.edu.scau.cmi.ema.domain.*;
import java.util.Set;
import com.alibaba.fastjson.annotation.JSONField;

@Entity
@NamedQueries({ @NamedQuery(name = "findAllEvent9slrs", query = "select myEvent9slr from Event9slr myEvent9slr"),
		@NamedQuery(name = "findEvent9slrByNumber", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.number = ?1"),
		@NamedQuery(name = "findEvent9slrByNumberContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.number like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByName", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.name = ?1"),
		@NamedQuery(name = "findEvent9slrByNameContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.name like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByFood", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.food = ?1"),
		@NamedQuery(name = "findEvent9slrByFoodContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.food like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByFoodtype", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.foodtype = ?1"),
		@NamedQuery(name = "findEvent9slrByFoodtypeContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.foodtype like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByDiscoverytime", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.discoverytime = ?1"),
		@NamedQuery(name = "findEvent9slrByDiscoverytimeContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.discoverytime like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByDiscoveryaddress", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.discoveryaddress = ?1"),
		@NamedQuery(name = "findEvent9slrByDiscoveryaddressContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.discoveryaddress like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrBySubject", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.subject = ?1"),
		@NamedQuery(name = "findEvent9slrBySubjectContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.subject like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByProducer", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.producer = ?1"),
		@NamedQuery(name = "findEvent9slrByProducerContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.producer like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrBySource", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.source = ?1"),
		@NamedQuery(name = "findEvent9slrBySourceContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.source like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByAdultertype", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.adultertype = ?1"),
		@NamedQuery(name = "findEvent9slrByAdultertypeContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.adultertype like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByFoodbatchfiller", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.foodbatchfiller = ?1"),
		@NamedQuery(name = "findEvent9slrByFoodbatchfillerContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.foodbatchfiller like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByAdulterlink", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.adulterlink = ?1"),
		@NamedQuery(name = "findEvent9slrByAdulterlinkContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.adulterlink like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByDetectmethod", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.detectmethod = ?1"),
		@NamedQuery(name = "findEvent9slrByDetectmethodContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.detectmethod like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByUrl", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.url = ?1"),
		@NamedQuery(name = "findEvent9slrByUrlContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.url like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByDescription", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.description = ?1"),
		@NamedQuery(name = "findEvent9slrByDescriptionContaining", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.description like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9slrByImported", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.imported = ?1"),
		@NamedQuery(name = "findEvent9slrByIslocked", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.islocked = ?1"),
		@NamedQuery(name = "findEvent9slrById", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.id = ?1"),
		@NamedQuery(name = "findEvent9slrByPrimaryKey", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.id = ?1 "),
		@NamedQuery(name = "deleteEvent9slrsByIds", query = "delete Event9slr where id in (?1)"),
		@NamedQuery(name = "findEvent9slrsByIds", query = "select myEvent9slr from Event9slr myEvent9slr where myEvent9slr.id in (?1)"),
		@NamedQuery(name = "findEvent9slrByPhyscialPrimaryKey", query = "select myEvent9slr from Event9slr myEvent9slr where  myEvent9slr.number = ?1"),
		@NamedQuery(name = "countEvent9slrsByName", query = "select count(myEvent9slr)  from Event9slr myEvent9slr where myEvent9slr.name like concat('%',?1,'%')") })
@Table(catalog = "ema", name = "event9slr")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "ema/cn/edu/scau/cmi/ema/domain", name = "Event9slr")
@XmlRootElement(namespace = "ema/cn/edu/scau/cmi/ema/domain")

public class Event9slr implements Serializable, Comparable<Event9slr> {

	private static final long serialVersionUID = 1L;

	@Column(name = "id", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@XmlElement
	Integer id;

	@Column(name = "number")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String number;

	@Column(name = "name")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String name;

	@Column(name = "food")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String food;

	@Column(name = "foodtype")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String foodtype;

	@Column(name = "discoverytime")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String discoverytime;

	@Column(name = "discoveryaddress")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String discoveryaddress;

	@Column(name = "subject")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String subject;

	@Column(name = "producer")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String producer;

	@Column(name = "source")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String source;

	@Column(name = "adultertype")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String adultertype;

	@Column(name = "foodbatchfiller")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String foodbatchfiller;

	@Column(name = "adulterlink")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String adulterlink;

	@Column(name = "detectmethod")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String detectmethod;

	@Column(name = "url")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String url;

	@Column(name = "description")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String description;

	@Column(name = "imported")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Boolean imported;

	@Column(name = "islocked")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Boolean islocked;

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return this.id;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getNumber() {
		return this.number;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return this.name;
	}

	public void setFood(String food) {
		this.food = food;
	}

	public String getFood() {
		return this.food;
	}

	public void setFoodtype(String foodtype) {
		this.foodtype = foodtype;
	}

	public String getFoodtype() {
		return this.foodtype;
	}

	public void setDiscoverytime(String discoverytime) {
		this.discoverytime = discoverytime;
	}

	public String getDiscoverytime() {
		return this.discoverytime;
	}

	public void setDiscoveryaddress(String discoveryaddress) {
		this.discoveryaddress = discoveryaddress;
	}

	public String getDiscoveryaddress() {
		return this.discoveryaddress;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getSubject() {
		return this.subject;
	}

	public void setProducer(String producer) {
		this.producer = producer;
	}

	public String getProducer() {
		return this.producer;
	}

	public void setSource(String source) {
		this.source = source;
	}

	public String getSource() {
		return this.source;
	}

	public void setAdultertype(String adultertype) {
		this.adultertype = adultertype;
	}

	public String getAdultertype() {
		return this.adultertype;
	}

	public void setFoodbatchfiller(String foodbatchfiller) {
		this.foodbatchfiller = foodbatchfiller;
	}

	public String getFoodbatchfiller() {
		return this.foodbatchfiller;
	}

	public void setAdulterlink(String adulterlink) {
		this.adulterlink = adulterlink;
	}

	public String getAdulterlink() {
		return this.adulterlink;
	}

	public void setDetectmethod(String detectmethod) {
		this.detectmethod = detectmethod;
	}

	public String getDetectmethod() {
		return this.detectmethod;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUrl() {
		return this.url;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return this.description;
	}

	public void setImported(Boolean imported) {
		this.imported = imported;
	}

	public Boolean getImported() {
		return this.imported;
	}

	public void setIslocked(Boolean islocked) {
		this.islocked = islocked;
	}

	public Boolean getIslocked() {
		return this.islocked;
	}

	public void copy(Event9slr that) {

		setId(that.getId());

		setNumber(that.getNumber());
		setName(that.getName());
		setFood(that.getFood());
		setFoodtype(that.getFoodtype());
		setDiscoverytime(that.getDiscoverytime());
		setDiscoveryaddress(that.getDiscoveryaddress());
		setSubject(that.getSubject());
		setProducer(that.getProducer());
		setSource(that.getSource());
		setAdultertype(that.getAdultertype());
		setFoodbatchfiller(that.getFoodbatchfiller());
		setAdulterlink(that.getAdulterlink());
		setDetectmethod(that.getDetectmethod());
		setUrl(that.getUrl());
		setDescription(that.getDescription());
		setImported(that.getImported());
		setIslocked(that.getIslocked());

	}

	public Event9slr() {

	}

	@Override
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");

		buffer.append("number=[").append(number).append("] ");
		buffer.append("name=[").append(name).append("] ");
		buffer.append("food=[").append(food).append("] ");
		buffer.append("foodtype=[").append(foodtype).append("] ");
		buffer.append("discoverytime=[").append(discoverytime).append("] ");
		buffer.append("discoveryaddress=[").append(discoveryaddress).append("] ");
		buffer.append("subject=[").append(subject).append("] ");
		buffer.append("producer=[").append(producer).append("] ");
		buffer.append("source=[").append(source).append("] ");
		buffer.append("adultertype=[").append(adultertype).append("] ");
		buffer.append("foodbatchfiller=[").append(foodbatchfiller).append("] ");
		buffer.append("adulterlink=[").append(adulterlink).append("] ");
		buffer.append("detectmethod=[").append(detectmethod).append("] ");
		buffer.append("url=[").append(url).append("] ");
		buffer.append("description=[").append(description).append("] ");
		buffer.append("imported=[").append(imported).append("] ");
		buffer.append("islocked=[").append(islocked).append("] ");

		return buffer.toString();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Event9slr))
			return false;
		Event9slr comparedEvent9slr = (Event9slr) obj;
		if (!CheckPropertyEqual(this.number, comparedEvent9slr.number)) {
			return false;
		}
		return true;
	}

	public static <T> boolean CheckPropertyEqual(T originProperty, T comparedProperty) {
		// 基本类型经过参数传递后会自动装箱
		String[] className = originProperty.getClass().getName().split("\\.");
		if (className[0].equals("java") && className[1].equals("math")) {
			return ((Comparable) originProperty).compareTo(comparedProperty) == 0 ? true : false;
		} else {
			return originProperty.equals(comparedProperty);
		}
	}

	@Override
	public int compareTo(Event9slr o) {
		if (this.getId() > o.getId()) {
			return 1;
		} else if (this.getId() == o.getId()) {
			return 0;
		} else {
			return -1;
		}

	}
}
